<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var arr = [];

    var count = arr.push('red', 'green');	// ['red', 'green']
    alert(count);	// 2

    count = arr.unshift('blue', 'black');	// ['blue', 'black', 'red', 'green']
    alert(count);	// 4

    var color = arr.pop();
    alert(color);	// 'green'

    color = arr.shift();
    alert(color);	// 'blue'
  </script>
</body>

</html>